//
//  UIDevice+Util.m
//  wozhua
//
//  Created by 王洋 on 14-9-29.
//  Copyright (c) 2014年 王洋. All rights reserved.
//

#import "UIDevice+Util.h"
#include <sys/sysctl.h>

@implementation UIDevice (Util)

- (NSString *)platform {
    size_t size;
    sysctlbyname("hw.machine", NULL, &size, NULL, 0);
    char *answer = malloc(size);
    sysctlbyname("hw.machine", answer, &size, NULL, 0);
    NSString *results = [NSString stringWithCString:answer encoding: NSUTF8StringEncoding];
    free(answer);
    if (!results) {
        results = @"";
    }
    return results;
}

@end
